<? require_once('../include/connect.inc.php');
	session_start();
	$_SESSION['r_student_id']=1;
	
	$sumscore;
	//ตรวจคำตอบ
	$query= query("SELECT count(*)as score FROM tb_dotest_detail,tb_choice where tb_dotest_detail.choice_id=tb_choice.choice_id and tb_choice.answer=1 and tb_dotest_detail.dotest_id='".$_GET[dotest_id]."' ");
	while ($rs = fetch_array($query)) {
	$sumscore=$sumscore+$rs['score'];
	$choice=$rs['choice_id'];
	}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<? 
$sumquestion=0;
	$query= query("SELECT choice_id FROM tb_dotest_detail where dotest_id='".$_GET[dotest_id]."' ");
			while ($rs = fetch_array($query)) {
			$choice=$rs['choice_id'];
			$sumquestion++;
?>
ขอที่ทำไป คือ <? echo "$choice";?></br>
<? }?>

<table width="200" border="1">
  <tr>
    <td width="92">ข้อสอบชุดที่</td>
    <td width="92">&nbsp;</td>
  </tr>
  <tr>
    <td>วิชา</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>หัวข้อสอบ</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>จำนวนข้อ</td>
    <td><? echo "$sumquestion";?> ข้อ</td>
  </tr>
  <tr>
    <td>คะแนนเต็ม</td>
    <td><? echo "$sumquestion";?>  คะแนน</td>
  </tr>
  <tr>
    <td>คะแนนที่ได้</td>
    <td><? echo "$sumscore";?> คะแนน</td>
  </tr>
</table>
</body>
</html>
